define(["angularAMD"], function (angularAMD) {
    angularAMD.service('PrintSetting', ['$rootScope', '$filter', '$translate', 'config', 'MMWService', '$mdDialog',
        function($rootScope, $filter, $translate, config, $MMWService, $mdDialog){
            this.init = function(options){
                $mdDialog.dialog(
                    'module/moduleA/program/B01/B0102/PrintSetting.tmp.html',
                    function(dialog){
                        return {
                            css_url:'module/moduleA/program/B01/B0102/PrintSetting.css',
                            settings:{up:0, down:0, left:0, right:0},
                            beforeShown:function(){
                                var settings = JSON.parse(localStorage.getItem(config.appName + '_PrintSetting'));
                                if(settings){
                                    dialog.settings = settings;
                                }
                            },
                            back:function(){
                                dialog.hide();
                            },
                            confirm:function(){
                                var temp = dialog.settings;
                                dialog.hide();
                                localStorage.setItem(config.appName + '_PrintSetting', JSON.stringify(temp));
                                if(options.callback)
                                    options.callback(temp);
                            }
                        };
                    }
                );
            };
        }
    ]);
});
